
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>success</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        tr:nth-child(odd) {
            background-color: #fcf8e3;
        }
    </style>
</head>
<body>
<div class="page-header" >
    <h2>
        <small style="margin-left: 36px;">流动人口管理系统</small>
        <a   id="link1" href="${pageContext.request.contextPath}/firstPage" style="margin-left: 800px;font-size: 15px; color: #888888">首页</a>
        <a  id="link2" href="${pageContext.request.contextPath}/child" style="margin-left: 20px;font-size: 15px; color: #888888">子女信息</a>
        <a id="link3" href="${pageContext.request.contextPath}/externalPopulation" style="margin-left: 20px;font-size: 15px; color: #888888">流动人口</a>
        <a id="link4" href="${pageContext.request.contextPath}/residentialPass"  style="margin-left: 20px;font-size: 15px; color: #888888">登记信息</a>
    </h2>
</div>

<div  style="margin-top: 20px">
    <div class="container">
        <div class="row">
            <div class="span12">
                <ul class="breadcrumb" style=" background-color: rgb(255, 255, 255);">
                    <li>
                        <a href="${pageContext.request.contextPath}/firstPage">主页</a>
                        <span class="divider"> »</span>
                    </li>
                    <li class="active">
                        流动人口信息
                        <span class="divider"> »</span>
                    </li>
                </ul>
                <table  id="tab" class="table table-bordered table-hover" style="overflow:hidden;border: 2px #000;border-radius: 3px">
                    <thead>
                    <tr class="info">
                        <td>姓名</td>
                        <td>身份证号</td>
                        <td>居住证</td>
                        <td>居住状态</td>
                        <td>应届毕业生</td>
                        <td>社保账号</td>
                        <td>操作</td>
                    </tr>
                    </thead>

                    <c:forEach items="${externalPopulations}" var="externalPopulation">
                        <tr>
                            <td>${externalPopulation.residentialPass.name}</td>
                            <td>${externalPopulation.ID_number}</td>
                            <td>${externalPopulation.residential_pass}</td>
                            <td>${externalPopulation.residence}</td>
                            <td>${externalPopulation.fresh_graduate}</td>
                            <td>${externalPopulation.social_security_account}</td>
                            <td>
                                <button id ="update" class="btn btn-default" style="margin-right: 10px">修改</button>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
    </div>
</div>
</form>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <form action="${pageContext.request.contextPath}/externalPopulation/updateE" method="post">
            <div class="modal-content">
                <div class="modal-header">
                    <h3>
                        修改<input type="text"  id="name" name="name"  style= "background-color:transparent;border:0;width:50px" disabled>个人信息
                    </h3>
                </div>
                <div class="modal-body">

                    <div class="form-group">
                        <label for="ID_number">身份证号：</label>
                        <input type="text" class="form-control" name="ID_number" id="ID_number" readonly></br>
                    </div>
                    <div class="form-group">
                        <label for="residential_pass">居住证：</label>
                        <input type="text" class="form-control" id="residential_pass" name="residential_pass" readonly></br>
                    </div>
                    <div class="form-group">
                        <label for="residence">居住状态：</label>
                        <input type="text" class="form-control" id="residence" name="residence"></br>
                    </div>
                    <div class="form-group">
                        <label for="fresh_graduate">应届毕业生：</label>
                        <input type="text" class="form-control" id="fresh_graduate" name="fresh_graduate"></br>
                    </div>
                    <div class="form-group">
                        <label for="social_security_account">社保账号：</label>
                        <input type="text" class="form-control" id="social_security_account" name="social_security_account"></br>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span
                            class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                    <input type="submit" class="btn btn-primary" value="保存"  >
                </div>

            </div>
        </form>
    </div>
</div>
</body>
</html>
<script>
    //注册新增按钮的事件
    $(function() {

        $("#tab").on("click", "#update", function(event) {
            $('#myModal').modal();
            $("#name").val($(this).closest("tr").find("td").eq(0).text());
            $("#ID_number").val($(this).closest("tr").find("td").eq(1).text());
            $("#residential_pass").val($(this).closest("tr").find("td").eq(2).text());
            $("#residence").val($(this).closest("tr").find("td").eq(3).text());
            $("#fresh_graduate").val($(this).closest("tr").find("td").eq(4).text());
            $("#social_security_account").val($(this).closest("tr").find("td").eq(5).text());
        });
    });
</script>
